package net.xujialiang.XTestRPA.Repository;

import net.xujialiang.XTestRPA.Entity.XRPALog;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;

import java.util.Optional;


public interface LogRepository extends CrudRepository<XRPALog, Integer> {
    Page<XRPALog> findByTtc(String ttc, Pageable page);
    Page<XRPALog> findByTtcAndModule(String ttc, String module, Pageable page);
    @Query("SELECT c FROM XRPALog c WHERE c.ttc = :ttc and (:module is null or c.module = :module) and (:account is null"
            + " or c.account = :account)")
    Page<XRPALog> findByTtcAndModuleAndAccount(@Param("ttc") String ttc, @Param("module") String module, @Param("account") String account, Pageable page);
}
